home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_51878.txt < prev    next >
Text File  |  1991-02-27  |  1KB  |  39 lines

  1. -- card: 51878 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 6
  9. ----- text -----
  10. 7.1  Text Substitution
  11.  
  12. -- part contents for background part 4
  13. ----- text -----
  14. Preprocessor directives are identified by beginning with the '#' symbol, and are generally not indented beyond the first column.  A trailing semicolon is NOT used.
  15.  
  16. TEXT SUBSTITUTION, or macro substitution, is performed using the '#define' directive in the following syntax, usually located at the beginning of the source file:
  17.  
  18.     # define       NAME        replacement text              /* no trailing semicolon! */
  19.  
  20. Before compilation the preprocessor will replace all occurrences of NAME in the source file with the replacement text.  The name to be replaced follows the same rules as for C variable and function identifiers.  By convention this is nearly always capitalized, to avoid confusion with other variable and function identifiers.  There are very few grammatical restrictions on the replacement text.
  21.  
  22. One of the most common uses of macro substitution is naming constants:
  23.  
  24.     # define       TRUE       1
  25.     # define       FALSE     0
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. -- part contents for background part 7
  38. ----- text -----
  39. 168